# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Content.V2.Model.OrderLineItem do
  @moduledoc """


  ## Attributes

  *   `annotations` (*type:* `list(GoogleApi.Content.V2.Model.OrderMerchantProvidedAnnotation.t)`, *default:* `nil`) - Annotations that are attached to the line item.
  *   `cancellations` (*type:* `list(GoogleApi.Content.V2.Model.OrderCancellation.t)`, *default:* `nil`) - Cancellations of the line item.
  *   `id` (*type:* `String.t`, *default:* `nil`) - The ID of the line item.
  *   `price` (*type:* `GoogleApi.Content.V2.Model.Price.t`, *default:* `nil`) - Total price for the line item. For example, if two items for $10 are purchased, the total price will be $20.
  *   `product` (*type:* `GoogleApi.Content.V2.Model.OrderLineItemProduct.t`, *default:* `nil`) - Product data as seen by customer from the time of the order placement. Note that certain attributes values (e.g. title or gtin) might be reformatted and no longer match values submitted via product feed.
  *   `quantityCanceled` (*type:* `integer()`, *default:* `nil`) - Number of items canceled.
  *   `quantityDelivered` (*type:* `integer()`, *default:* `nil`) - Number of items delivered.
  *   `quantityOrdered` (*type:* `integer()`, *default:* `nil`) - Number of items ordered.
  *   `quantityPending` (*type:* `integer()`, *default:* `nil`) - Number of items pending.
  *   `quantityReadyForPickup` (*type:* `integer()`, *default:* `nil`) - Number of items ready for pickup.
  *   `quantityReturned` (*type:* `integer()`, *default:* `nil`) - Number of items returned.
  *   `quantityShipped` (*type:* `integer()`, *default:* `nil`) - Number of items shipped.
  *   `returnInfo` (*type:* `GoogleApi.Content.V2.Model.OrderLineItemReturnInfo.t`, *default:* `nil`) - Details of the return policy for the line item.
  *   `returns` (*type:* `list(GoogleApi.Content.V2.Model.OrderReturn.t)`, *default:* `nil`) - Returns of the line item.
  *   `shippingDetails` (*type:* `GoogleApi.Content.V2.Model.OrderLineItemShippingDetails.t`, *default:* `nil`) - Details of the requested shipping for the line item.
  *   `tax` (*type:* `GoogleApi.Content.V2.Model.Price.t`, *default:* `nil`) - Total tax amount for the line item. For example, if two items are purchased, and each have a cost tax of $2, the total tax amount will be $4.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations =>
            list(GoogleApi.Content.V2.Model.OrderMerchantProvidedAnnotation.t()) | nil,
          :cancellations => list(GoogleApi.Content.V2.Model.OrderCancellation.t()) | nil,
          :id => String.t() | nil,
          :price => GoogleApi.Content.V2.Model.Price.t() | nil,
          :product => GoogleApi.Content.V2.Model.OrderLineItemProduct.t() | nil,
          :quantityCanceled => integer() | nil,
          :quantityDelivered => integer() | nil,
          :quantityOrdered => integer() | nil,
          :quantityPending => integer() | nil,
          :quantityReadyForPickup => integer() | nil,
          :quantityReturned => integer() | nil,
          :quantityShipped => integer() | nil,
          :returnInfo => GoogleApi.Content.V2.Model.OrderLineItemReturnInfo.t() | nil,
          :returns => list(GoogleApi.Content.V2.Model.OrderReturn.t()) | nil,
          :shippingDetails => GoogleApi.Content.V2.Model.OrderLineItemShippingDetails.t() | nil,
          :tax => GoogleApi.Content.V2.Model.Price.t() | nil
        }

  field(:annotations, as: GoogleApi.Content.V2.Model.OrderMerchantProvidedAnnotation, type: :list)
  field(:cancellations, as: GoogleApi.Content.V2.Model.OrderCancellation, type: :list)
  field(:id)
  field(:price, as: GoogleApi.Content.V2.Model.Price)
  field(:product, as: GoogleApi.Content.V2.Model.OrderLineItemProduct)
  field(:quantityCanceled)
  field(:quantityDelivered)
  field(:quantityOrdered)
  field(:quantityPending)
  field(:quantityReadyForPickup)
  field(:quantityReturned)
  field(:quantityShipped)
  field(:returnInfo, as: GoogleApi.Content.V2.Model.OrderLineItemReturnInfo)
  field(:returns, as: GoogleApi.Content.V2.Model.OrderReturn, type: :list)
  field(:shippingDetails, as: GoogleApi.Content.V2.Model.OrderLineItemShippingDetails)
  field(:tax, as: GoogleApi.Content.V2.Model.Price)
end

defimpl Poison.Decoder, for: GoogleApi.Content.V2.Model.OrderLineItem do
  def decode(value, options) do
    GoogleApi.Content.V2.Model.OrderLineItem.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Content.V2.Model.OrderLineItem do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
